﻿<%@ WebHandler Language="C#" Class="ContainerStepTransactionCheckPopupHandler" %>

using System;
using System.Web;
using System.Data;
using System.Web.SessionState;
using System.Drawing;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Camstar.WebClient.FormsBuilder.WebForm;
using Camstar.WebClient.WebServicesProxy.InSiteWebServices;
using Infragistics.WebUI.UltraWebGrid;
using BusinessRule.DTO;
using BusinessRule.IBusiness;
using BusinessRule.BusinessFactory;
using BusinessRule.Common;
using System.Data.OracleClient;
using DatabaseAccess.DBUtility;
using Newtonsoft.Json;

public class ContainerStepTransactionCheckPopupHandler : IHttpHandler, IRequiresSessionState
{
    private  uLMSCommonIBusiness m_CommonObj=uMESBusinessFactory.instance.GetuLMSCommonObject();
    private  uLMSCheckIBusiness m_CheckObj= uMESBusinessFactory.instance.GetuLMSCheckObject();
    private  uLMSContainerIBusiness m_ContainerObj= uMESBusinessFactory.instance.GetuLMSContainerObject();
    private  uLMSWorkReportIBusiness m_WorkReportObj= uMESBusinessFactory.instance.GetuLMSWorkReportObject();
    private  uLMSContainerShipIBusiness m_ContainerShip= uMESBusinessFactory.instance.GetuLMSContainerShipObject();
    private  uLMSDispatchIBusiness m_DispachObj= uMESBusinessFactory.instance.GetuLMSDispatchObject();
    private  uLMSCommissioningIBusiness m_Commission= uMESBusinessFactory.instance.GetuLMSCommissioning();
    private uLMSContainercurrentinfoIBusiness m_ConCurrentinfo = uMESBusinessFactory.instance.GetuLMSContainerCurrentInfoObject();

    CurrentUserInfo m_UserInfo;
    public void ProcessRequest(HttpContext context)
    {
        try
        {
            var action = context.Request["action"].ToString();
            m_UserInfo = (CurrentUserInfo)context.Session["CurrentUserInfo"];
            switch (action)
            {
                case "InitPageData": //页面数据初始化
                    InitPageData(context);
                    break;
                
                default:
                    break;
            }
        }
        catch (Exception ex)
        {
            var result = new uMESProcessResult();
            result.Result = false;
            result.Message = ex.Message;
            context.Response.ContentType = "text/html";
            context.Response.Write(JsonConvert.SerializeObject(result));
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

    /// <summary>
    /// 页面数据初始化
    /// </summary>
    /// <param name="context"></param>
    private void InitPageData(HttpContext context) 
    {
        DataTable dt = (DataTable)context.Session["PopupData"];
        var result = new uMESProcessResult();
        result.DBTable = dt;
        context.Response.Write(JsonConvert.SerializeObject(result));
    }

}